//
//  XYJLXResultTableViewCell.m
//  徙游记-01
//
//  Created by hcios on 2017/7/13.
//  Copyright © 2017年 鹿林. All rights reserved.
//

#import "XYJLXResultTableViewCell.h"
#import "XYJLXResultModel.h"


@implementation XYJLXResultTableViewCell

#pragma mark - 初始化方法
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //取消点击高亮状态
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10);
        self.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10);
        [self setupSubViews];
    }
    return self;
}

#pragma mark - 初始化cell
- (void)setupSubViews{
    //commentLabel
    _commentLabel = [[UILabel alloc] init];
    _commentLabel.numberOfLines = 0;
    [_commentLabel setFont:[UIFont fontWithName:FONT_NAME_LTH size:13]];
    [_commentLabel setTextColor:[UIColor blackColor]];
    [self addSubview:_commentLabel];
    //userLabel
    _userLabel = [[UILabel alloc] init];
    _userLabel.numberOfLines = 0;
    _userLabel.textAlignment = NSTextAlignmentLeft;
    [_userLabel setFont:[UIFont fontWithName:FONT_NAME_LTH size:11]];
    [_userLabel setTextColor:[UIColor lightGrayColor]];
    [self addSubview:_userLabel];
    //daysLabel
    _daysLabel = [[UILabel alloc] init];
    _daysLabel.numberOfLines = 0;
    _daysLabel.textAlignment = NSTextAlignmentRight;
    [_daysLabel setFont:[UIFont fontWithName:FONT_NAME_LTH size:11]];
    [_daysLabel setTextColor:[UIColor lightGrayColor]];
    [self addSubview:_daysLabel];
    
    
    self.backgroundColor = RGB(230, 241, 243);
}


- (void)setFrameModel:(XYJLXResultFrameModel *)frameModel {
    
    _frameModel = frameModel;
    
    XYJLXResultModel * model = frameModel.model;
    
    self.commentLabel.text = model.comment_description;
    self.commentLabel.frame = frameModel.commentFrame;
    
    self.userLabel.text = [NSString stringWithFormat:@"@%@",model.user_name];
    self.userLabel.frame = frameModel.userFrame;
    
    self.daysLabel.text = model.trip_start_date;
    self.daysLabel.frame = frameModel.dayFrame;
    
}

@end
